
#include <gfx/light.h>
#include <scene/entitynode.h>
#include <scene/light.h>


ceLightObject::ceLightObject(ceLight* light)
  : _light(light)
  , _castShadow (false)
{
  _litNodes.clear ();
}

void ceLightObject::SetLight(ceLight *light)
{
  _light = light;
}

ceLight* ceLightObject::GetLight()
{
  return _light;
}

const ceLight* ceLightObject::GetLight() const
{
  return _light;
}

void ceLightObject::SetCastShadow(bool castShadow)
{
  _castShadow = castShadow;
}

bool ceLightObject::CastsShadow() const
{
  return _castShadow;
}

void ceLightObject::AddNode(ceEntityNode *node)
{
  _litNodes.push_back (node);
}

std::vector<ceEntityNode*>& ceLightObject::GetLitNodes()
{
  return _litNodes;
}

bool ceLightObject::MarkRenderNodes(bool render)
{
  for (unsigned i=0, j=_litNodes.size (); i<j; i++)
    {
      ceEntityNode* n = _litNodes[i];
      n->MarkForRendering(render);
    }

  return _litNodes.size () != 0;
}

